import os, sys

filename = '30332-iris-seg-data-v2.txt'

fd = open(filename, 'r')

unwrap = 'unwrap-headless.exe'
lines = fd.readlines()
x = y = r = X = Y = R = 0

lib = {}
for i in lines:
   m = i.split()
   x = m[3]
   y = m[2]
   r = m[4]
   X = m[6]
   Y = m[5]
   R = m[7]
   cmd = ''
   if m[0] == 'L':
      cmd = str(unwrap + ' -x ' + x + ' -y ' + y + ' -r ' + r + ' -X ' + X + ' -Y ' + Y + ' -R ' + R + ' -i ' + 'CSE30332-left-irises/' + m[1] +' -o ' + 'CSE30332-seg-data/' + m[1].split('.')[0] + 'l.' + m[1].split('.')[1])
   elif m[0] == 'R':
      cmd = str(unwrap + ' -x ' + x + ' -y ' + y + ' -r ' + r + ' -X ' + X + ' -Y ' + Y + ' -R ' + R + ' -i ' + 'CSE30332-right-irises/' + m[1] + ' -o ' + 'CSE30332-seg-data/' + m[1].split('.')[0] + 'r.' + m[1].split('.')[1])
   else: break
   if cmd != '':
      print cmd
      os.system(cmd)

